<?php

class MM_ViewRenderer extends Zend_Controller_Action_Helper_ViewRenderer {
	
	public function render($action = null, $name = null, $noController = null) {
		
		if ($this->view->isInfobox()) {
			
			$action = 'infobox';
			$noController = true;
			
		}
		
       	$this->setRender($action, $name, $noController);
        $path = $this->getViewScript();
        
        if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
 				$_SERVER ['HTTP_X_REQUESTED_WITH']  == 'XMLHttpRequest') {
        	$this->renderScript($path, $name);
 		}else if($this->view->isPrintable()){
        	$this->renderScript('print-header.phtml', null);
        	$this->renderScript($path, $name);
        	$this->renderScript('print-footer.phtml', null);
 		}else {
        	$this->renderScript('header.phtml', null);
        	$this->renderScript($path, $name);
        	$this->renderScript('footer.phtml', null);
 		}
        
    }
	
}